import 'package:flutter_syt/datas/game/competitor.dart';

import 'extended_results.dart';

class Result {
  String? sortOrder;
  String? startOrder;
  String? startSortOrder;
  String? rank;
  String? result;

  ExtendedResults? extendedResults;
  Competitor? competitor;

  // GameCompetitor({this.competitor});

  // factory GameCompetitor.fromJson(Map<String, dynamic> json) {
  //   return GameCompetitor(
  //     competitor: json['Competitor'] == null
  //         ? null
  //         : Competitor.fromJson(json['Competitor'] as Map<String, dynamic>),
  //   );
  // }

  // Map<String, dynamic> toJson() => {
  //       'Competitor': competitor?.toJson(),
  //     };
  Result(
      {this.sortOrder,
      this.startOrder,
      this.startSortOrder,
      this.extendedResults,
      this.competitor,
      this.rank,
      this.result});

  factory Result.fromJson(Map<String, dynamic> json) => Result(
        sortOrder: json['SortOrder'] as String?,
        startOrder: json['StartOrder'] as String?,
        startSortOrder: json['StartSortOrder'] as String?,
        rank: json['Rank'] as String?,
        result: json['Result'] as String?,
        extendedResults: json['ExtendedResults'] == null
            ? null
            : ExtendedResults.fromJson(
                json['ExtendedResults'] as Map<String, dynamic>),
        competitor: json['Competitor'] == null
            ? null
            : Competitor.fromJson(json['Competitor'] as Map<String, dynamic>),
      );

  Map<String, dynamic> toJson() => {
        'SortOrder': sortOrder,
        'StartOrder': startOrder,
        'Rank': rank,
        'Result': result,
        'StartSortOrder': startSortOrder,
        'ExtendedResults': extendedResults?.toJson(),
        'Competitor': competitor?.toJson(),
      };
}
